<template>
	<!-- 自定义表单详情 -->
	<view class="page">
		<status-bar :title='title'></status-bar>
		<formList v-if='form_list' :ids='form_list' info='true' barTitle='1' @title='getTitle'></formList>
		<empty v-else type='1' cat='4' msg='表单参数有误!!!'></empty>
		
		<view class="my-record thmeBg" @click='toRecord' :style="{'--color':color}">
			<image :src="staticUrl+'/images/jh_up/reserve.png'" mode="widthFix"></image>
		</view>
		
		<showModel @cancelFunc='showModal = false' v-if='showModal' type='2'></showModel>
	</view>
</template>
<script>
	import formList from '../../components/formList.vue'
	export default {
		components: {
			formList
		},
		data() {
			return {
				showModal: false,
				form_list:'',// 自定义表单id
				title:' ',
				color: getApp().globalData.color,
				staticUrl: this.staticUrl,
			}
		},
		onShow() {
			var that = this;
			uni.getStorage({
				key: 'vid',
				success(res) {
					if(!res.data){
						that.showModal = true
					}
				},
				fail() {
					that.showModal = true
				}
			})
		},
		onLoad(options) {
			if(options.ordId){
				this.form_list = [{'order_id':options.ordId}];
				// #ifdef H5
				this.H5Share('pageType=15&gid=' + options.ordId)
				// #endif
			}else{
				// #ifdef H5
				this.H5Share()
				// #endif
			}
		},
		onShareAppMessage() {
			let shareData = uni.getStorageSync('shareData');
			let vid = uni.getStorageSync('vid');
			return {
				title: shareData.title,
				desc: shareData.desc,
				path: '/pages/index/index?share_v_id=' + vid+'&pageType=16&gid='+this.form_list[0].order_id,
				imageUrl: shareData.imageUrl
			}
		},
		methods:{
			getTitle(e){
				this.title = e;
			},
			toRecord(){
				var that = this;
				uni.getStorage({
					key: 'vid',
					success(res) {
						if(!res.data || res.data == 0){
							that.showModal = true
						}else{
							uni.navigateTo({
								url:'/pages/reserve/myRreserve'
							})
						}
					},
					fail() {
						that.showModal = true
					}
				})
			}
		}
	}
</script>

<style scoped lang="scss">
	.page{
		padding-bottom: 30rpx;
		.my-record{
			position: fixed;
			right: 0;
			height: 65upx;
			top: 340upx;
			border-radius: 30upx 0 0 30upx;
			text-align: center;
			display: flex;
			justify-content: center;
			align-items: center;
			color: white;
			font-size: 24upx;
			padding: 4upx 10upx 4upx 26upx;
			image{
				width: 40upx;
				height: 44upx;
				margin-right: 4upx;
			}
		}
	}
</style>
